package org.anachronos.jeep.ui.trace;

import org.eclipse.emf.common.ui.viewer.IViewerProvider;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;

public abstract class TraceBasePage extends FormPage implements IViewerProvider {

	public TraceBasePage(final FormEditor editor, final String id, final String title) {
		super(editor, id, title);
	}

	protected void registerContextMenu(final Viewer viewer) {
		final MenuManager menuManager = new MenuManager("#Popup");
		final Control control = viewer.getControl();
		final Menu menu = menuManager.createContextMenu(control);
		control.setMenu(menu);
		getSite().registerContextMenu(menuManager, viewer);
	}
}
